<?php
namespace Home\Controller;
use Think\Controller;
class ApplyController extends Controller {
    public function index(){
        $this->display();
    }
    public function feedback(){
        $uid=session('uid');
        $all=M('users')->where(array("uid"=>$uid))->select();
        $username = $_POST['username'];
        $tel = $_POST['tel'];
        $message = $_POST['message'];
        $uname=$all[0]["username"];
        $t=$all[0]["tel"];
        if($username!=$uname){
            $this->error('请用本人用户名，谢谢!', U("Home/Apply/index"));
        }
        elseif ($tel!=$t){
            $this->error('请输入本人联系电话，谢谢!', U("Home/Apply/index"));
        }
        else{ $Fankui = M("fankui");
            $data['username'] = $username;
            $data['tel'] = $tel;
            $data['message'] = $message;
            $add=$Fankui->add($data);
        }

        if ($add) {

            $this->success('反馈提交成功!我们会认真反思的哦，亲！！   >^_^<', U("Home/Apply/index"));

        } else {
            $this->error('反馈提交失败!请重新提交，抱歉了亲', U("Home/Apply/index"));
        }

    }
}